package models

import "gorm.io/gorm"

// 用户表
type User struct {
	gorm.Model
	Account   string `gorm:"type:char(11);not null;"`     //手机号码
	Password  string `gorm:"type:char(32);not null;"`     //密码
	Name      string `gorm:"type:varchar(30);not null;"`  //用户昵称
	HeadImage string `gorm:"type:varchar(500);not null;"` //头像
}

// 课程表
type Course struct {
	gorm.Model
	Title     string  `gorm:"type:varchar(50);not null;"`   //课程标题
	TeacherId int     `gorm:"type:int(10);not null;"`       //讲师id
	Category  string  `gorm:"type:varchar(30);not null;"`   //课程分类
	Price     float64 `gorm:"type:decimal(10,2);not null;"` //价格
	Image     string  `gorm:"type:varchar(500);not null;"`  //封面
	Info      string  `gorm:"type:varchar(300);not null;"`  //课程简介
}

// 讲师表
type Teacher struct {
	gorm.Model
	Name  string `gorm:"type:varchar(30);not null;"`  //讲师姓名
	Info  string `gorm:"type:varchar(300);not null;"` //讲师简介
	Image string `gorm:"type:varchar(500);not null;"` //讲师头像
}

// 评价表
type Comment struct {
	gorm.Model
	Content  string `gorm:"type:varchar(300);not null;"` //评价内容
	CourseId int    `gorm:"type:int(10);not null;"`      //课程id
	UserId   int    `gorm:"type:int(10);not null;"`      //用户id
}

// 收藏表
type Collection struct {
	gorm.Model
	UserId   int `gorm:"type:int(10);not null;"` //用户id
	CourseId int `gorm:"type:int(10);not null;"` //课程id
}

type CourseData struct {
	Course
	TeacherName string
}

type CollectData struct {
	Collection
	Title string
	Name  string
}
